import axios from "axios";

type requestMethods = "GET" | "POST" | "DELETE" | "PUT" | "PATCH";
interface requestParams {}
interface requestData {}

export default function request(
  method: requestMethods = "GET",
  url: string,
  data?: requestParams | requestData,
  options?: object
) {
  return axios({
    method,
    url,
    [method === "GET" ? "params" : "data"]: data,
    ...options,
  });
}
